<?php
declare (strict_types = 1);

namespace app\common\validate;
use app\common\model\user\User;
use think\Validate;
use app\common\model\content\Topic;
use app\common\model\content\Article;
use app\common\model\content\Image as ImageModel;

class Image extends Validate
{
    protected $rule = [
        Topic::UP_FIELD        => 'fileSize:716800|fileExt:jpg,jpeg,png,gif|image',
        Article::UP_FIELD      => 'fileSize:716800|fileExt:jpg,jpeg,png,gif|image',
        ImageModel::FIELD_NAME => 'fileSize:716800|fileExt:jpg,jpeg,png,gif|image',
        User::UP_FIELD         => 'fileSize:716800|fileExt:jpg,jpeg,png,gif|image',


    ];

    protected $message = [
        Topic::UP_FIELD.'fileSize' => '图片太大',
        Topic::UP_FIELD.'fileExt'  => '图片类型错误',
        Topic::UP_FIELD.'image'    => '非合法图片',

        Article::UP_FIELD.'fileSize' => '图片太大',
        Article::UP_FIELD.'fileExt'  => '图片类型错误',
        Article::UP_FIELD.'image'    => '非合法图片',

        ImageModel::FIELD_NAME.'fileSize' => '图片太大',
        ImageModel::FIELD_NAME.'fileExt'  => '图片类型错误',
        ImageModel::FIELD_NAME.'image'    => '非合法图片',

        User::UP_FIELD.'fileSize' => '图片太大',
        User::UP_FIELD.'fileExt'  => '图片类型错误',
        User::UP_FIELD.'image'    => '非合法图片',

    ];
}